run_day_11654_liz21_del_10_35

run_day_11654_liz21_del_10_35 <- st_read("/Users/rof011/coralseed/code/2021_2022_HighPRT_sim_examples/run_day_11654_liz21_del_10_35/run_day_11654_liz21_del_10_35.json", quiet=TRUE) |> 
  st_transform(20353)


run_day_11654_liz21_del_10_35_subset <- run_day_11654_liz21_del_10_35 |> 
  dplyr::filter(id %in% seq(0:5000)) |> 
  mutate(daytime=ymd_hms(time)) |> 
  mutate(hour=hour(daytime)) |> 
  mutate(time_group = floor_date(daytime, "30 minutes")) |> 
  na.omit()


seascape <- seascape_probability(reefoutline=reef_map, habitat=benthic_map)

tmap_mode("plot")

run_day_11654_liz21_del_10_35_anim <- tm_shape(seascape) +
  tm_polygons("class", alpha=0.2, legend.show=FALSE, border.lwd=0.02) +
tm_shape(run_day_11654_liz21_del_10_35_subset, is.master=TRUE) +
  tm_dots("time_group", pal="-Spectral", n=24, shape=21, border.lwd=0.5, size=0.1,
          border.col="black", legend.show=FALSE) +
tm_facets(along="time_group", free.coords=FALSE, free.scales=FALSE) +
  tmap_options(max.categories=1000, show.messages=FALSE) 

tmap_animation(
  run_day_11654_liz21_del_10_35_anim,
  filename = "run_day_11654_liz21_del_10_35_subset.gif",
  width = 1200,
  height = 800,
  delay = 20,
   fps =  5,
   loop = TRUE
)

run_day_12038_liz22_del_14_33

library(tidyverse)
library(lubridate)
library(sf)
library(tmap)
library(coralseed)

run_day_12038_liz22_del_14_33 <- st_read("/Users/rof011/coralseed/code/2021_2022_HighPRT_sim_examples/run_day_12038_liz22_del_14_33/run_day_12038_liz22_del_14_33.json", quiet=TRUE) |> 
  st_transform(20353)


run_day_12038_liz22_del_14_33_subset <- run_day_12038_liz22_del_14_33 |> 
  dplyr::filter(id %in% seq(0:5000)) |> 
  mutate(daytime=ymd_hms(time)) |> 
  mutate(hour=hour(daytime)) |> 
  mutate(time_group = floor_date(daytime, "30 minutes")) |> 
  na.omit()


seascape <- seascape_probability(reefoutline=reef_map, habitat=benthic_map)

tmap_mode("plot")

run_day_12038_liz22_del_14_33_anim <- tm_shape(seascape) +
  tm_polygons("class", alpha=0.2, legend.show=FALSE, border.lwd=0.02) +
tm_shape(run_day_12038_liz22_del_14_33_subset, is.master=TRUE) +
  tm_dots("time_group", pal="-Spectral", n=24, shape=21, border.lwd=0.5, size=0.1,
          border.col="black", legend.show=FALSE) +
tm_facets(along="time_group", free.coords=FALSE, free.scales=FALSE) +
  tmap_options(max.categories=1000, show.messages=FALSE) 

tmap_animation(
  run_day_12038_liz22_del_14_33_anim,
  filename = "run_day_12038_liz22_del_14_33_subset.gif",
  width = 1200,
  height = 800,
  delay = 20,
   fps =  5,
   loop = TRUE
)

run_day_12039_liz22_del_11_35

run_day_12039_liz22_del_11_35 <- st_read("/Users/rof011/coralseed/code/2021_2022_HighPRT_sim_examples/run_day_12039_liz22_del_11_35/run_day_12039_liz22_del_11_35.json", quiet=TRUE) |> 
  st_transform(20353)


run_day_12039_liz22_del_11_35_subset <- run_day_12039_liz22_del_11_35 |> 
  dplyr::filter(id %in% seq(0:5000)) |> 
  mutate(daytime=ymd_hms(time)) |> 
  mutate(hour=hour(daytime)) |> 
  mutate(time_group = floor_date(daytime, "30 minutes")) |> 
  na.omit()

seascape <- seascape_probability(reefoutline=reef_map, habitat=benthic_map)

tmap_mode("plot")

run_day_12039_liz22_del_11_35_anim <- tm_shape(seascape) +
  tm_polygons("class", alpha=0.2, legend.show=FALSE, border.lwd=0.02) +
tm_shape(run_day_12039_liz22_del_11_35_subset, is.master=TRUE) +
  tm_dots("time_group", pal="-Spectral", n=24, shape=21, border.lwd=0.5, size=0.1,
          border.col="black", legend.show=FALSE) +
tm_facets(along="time_group", free.coords=FALSE, free.scales=FALSE) +
  tmap_options(max.categories=1000, show.messages=FALSE) 

tmap_animation(
  run_day_12039_liz22_del_11_35_anim,
  filename = "run_day_12039_liz22_del_11_35_subset.gif",
  width = 1200,
  height = 800,
  delay = 20,
   fps =  5,
   loop = TRUE
)